import { createApp } from 'vue';
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import App from './App.vue';
import { createPinia } from 'pinia';
import Vant from 'vant';
import 'vant/lib/index.css';
import './element-plus-theme.scss'; // 引入自定义主题样式
import router from './router/index.js';

const app = createApp(App);
app.use(ElementPlus);
app.use(createPinia());
// 3. 注册你需要的组件
app.use(router);
app.use(Vant);
app.mount('#app');

// src/main.js
function showOfflineMessage() {
  const offlineMessage = document.createElement('div');
  offlineMessage.textContent = '当前处于无法连接网络状态。更改将保存在本地';
  offlineMessage.style.position = 'fixed';
  offlineMessage.style.bottom = '0';
  offlineMessage.style.left = '0';
  offlineMessage.style.right = '0';
  offlineMessage.style.backgroundColor = '#f44336';
  offlineMessage.style.color = 'white';
  offlineMessage.style.textAlign = 'center';
  offlineMessage.style.padding = '10px';
  document.body.appendChild(offlineMessage);
}

window.addEventListener('offline', showOfflineMessage);
